package com.tptech.nearme.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;

/**
 * Entity implementation class for Entity: User
 *
 */
@Entity
@Table(name="Users")
public class User implements Serializable {

	   
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="USER_ID_GENERATOR")
	@SequenceGenerator(allocationSize=1,initialValue=1,name="USER_ID_GENERATOR",sequenceName="USER_ID_SEQ")
	private Long userid;
	
	@NotNull(message="username not provided")
	@NotBlank(message="username cannot be blank")
	private String username;

	@NotNull(message="password not provided")
	@NotBlank(message="password cannot be blank")
	private String password;
	
	private String firstName;
	private String lastName;
	private String mobileNumber;
	private String email;
	
//	@Transient
	@OneToMany(mappedBy="user")
	private List<UserLocation> preferredLocations;
	
	private static final long serialVersionUID = 1L;

	public User() {
		super();
	}   
	public Long getUserid() {
		return this.userid;
	}

	public void setUserid(Long userid) {
		this.userid = userid;
	}   
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String userName) {
		this.username = userName;
	}   
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}   
	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}   
	public String getLastName() {
		return this.lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}   
	public String getMobileNumber() {
		return this.mobileNumber;
	}

	public void setMobileNumber(String mobileNumber) {
		this.mobileNumber = mobileNumber;
	}   
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public List<UserLocation> getPreferredLocations() {
		return preferredLocations;
	}
	
	public void setPreferredLocations(List<UserLocation> preferredLocations) {
		this.preferredLocations = preferredLocations;
	}
   
}
